package com.qf.forumproject.download.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qf.forumproject.download.dao.QfDownloadDao;
import com.qf.forumproject.download.service.QfDownloadService;

import com.qf.forumproject.entity.QfDownload;
import com.qf.forumproject.utils.SearchVo;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;

import javax.annotation.Resource;
import java.util.List;


/**
 * (QfDownload表)服务实现类
 *
 * @author protagonist
 * @since 2022-07-23 11:43:16
 */
@Service("qfDownloadServiceImpl")
public class QfDownloadServiceImpl extends ServiceImpl<QfDownloadDao, QfDownload> implements QfDownloadService {
    @Resource
    private QfDownloadDao qfDownloadDao;


    /**
     * 查询所有
     *
     * @return 实例对象的集合
     */
     @Override
     public List<QfDownload> selectAll(SearchVo searchVo) {
         PageHelper.startPage(searchVo.getPage(),searchVo.getLimit());
        return this.list();
     }
     
    /**
     * 根据条件查询
     *
     * @return 实例对象的集合
     */
    @Override
    public List<QfDownload> selectList(SearchVo searchVo) {
        //PageHelper.startPage(searchVo.getPage(),searchVo.getLimit());

        QueryWrapper<QfDownload> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("categoryname",searchVo.getCategoryname());
        return this.list(queryWrapper);
    }

    /**
     * 输入框搜索查询
     * @param searchVo
     * @return
     */
    @Override
    public List<QfDownload> vagueSelect(SearchVo searchVo) {

        QueryWrapper<QfDownload> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("dname",searchVo.getDname());

        return this.list(queryWrapper);
    }
}
